<!DOCTYPE html>
<html lang="en" class="no-js">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>login</title>
<link rel="stylesheet" type="text/css" href="css/normalize.css" />
<link rel="stylesheet" type="text/css" href="css/demo.css" />
<!--必要样式-->
<link rel="stylesheet" type="text/css" href="css/component.css" />
	<script src="public/layui/layui.js"></script>
	<!--[if IE]>
    <script src="js/html5.js"></script>
    <![endif]-->
</head>
<body>
		<div class="container demo-1">
			<div class="content">
				<div id="large-header" class="large-header">
					<canvas id="demo-canvas"></canvas>
					<div class="logo_box">
						<h3>欢迎进入酒店管理系统</h3>
<!--						<form action="#" name="f" method="post">-->
							<div class="input_outer">
								<span class="u_user"></span>
								<input id="username" name="username" class="text" style="color: #FFFFFF !important" value="admin" type="text" placeholder="请输入账户"/>
							</div>
							<div class="input_outer">
								<span class="us_uer"></span>
								<input id="password" name="password" class="text" style="color: #FFFFFF !important; position:absolute; z-index:100;" value="admin" type="password" placeholder="请输入密码"/>
							</div>
							<div class="input_outer">
								<span class="us_uer"></span>
								<input id="rePassword" name="rePassword" class="text" style="color: #FFFFFF !important; position:absolute; z-index:100;" value="admin" type="password" placeholder="请输入密码"/>
							</div>
<!--							<div class="mb2" style="display: flex;">-->
								<button class="act-but" id="register" style="color: #FFFFFF">注册</button>
								<a class="act-but submit" href="userLogin" style="color: #FFFFFF">已有账号直接登录</a>
<!--							</div>-->
<!--						</form>-->
					</div>
				</div>
			</div>
		</div><!-- /container -->
		<script src="js/TweenLite.min.js"></script>
		<script src="js/EasePack.min.js"></script>
		<script src="js/rAF.js"></script>
		<script src="js/demo-1.js"></script>
	</body>

<script>
	layui.use(['carousel','element','layer','jquery','table'], function() {
		let $ = layui.jquery;

		$("#register").on('click',function() {
			let username = $("#username").val();
			let password = $("#password").val();
			let rePassword = $("#rePassword").val();
			if (password !== rePassword) {
				alert('两次密码不一致');
				return;
			}
			$.ajax({
				url: 'user/register',
				type: 'POST',
				dataType:'json',
				contentType:'application/json;charset=UTF-8',
				data:JSON.stringify({
					"username": username,
					"password": password
				}),
				success: function (res) {
					if (res.code === 200) {
						location.href = '/hotal/front/userLogin';
					}else {
						alert("注册失败");
					}
				}
			})
		});
	});

</script>
</html>